home *** CD-ROM | disk | FTP | other *** search
/ Aminet 23 / Aminet 23 (1998)(GTI - Schatztruhe)[!][Feb 1998].iso / Aminet / dev / misc / gms_dev.lha / GMSDev / Source / Asm / Objects / ScreenObject.s < prev    next >
Text File  |  1997-12-16  |  5KB  |  176 lines

  1. ;-------T-------T------------------------T---------------------------------;
  2. ;Name:      Objects Example
  3. ;Author:    Paul Manias
  4. ;Copyright: DreamWorld Productions (c) 1996-1997.  Freely distributable.
  5. ;
  6. ;This demo will open a screen, based on the parameters in an external object
  7. ;file.  This allows a VERY high level of external editing that will alter
  8. ;how this program behaves, without having to reassemble it.
  9. ;
  10. ;This feature is highly important as it allows up to 100% configurability of
  11. ;your game, which previously has only been available to applications using
  12. ;libraries such as MUI.  However, it is even more powerful than this as
  13. ;graphic artists could not only create new datasets for your game, but also
  14. ;alter the dimensions, colours, resolution, attributes (and more) of your
  15. ;BOBs and screens.  Support for code segments is also available, so
  16. ;external functions could be altered and improved by programmers.  This will
  17. ;ensure that your game has a long lasting future as it keeps up with current
  18. ;technology and additions to GMS.
  19. ;
  20. ;I hope you make the most of external objects, its worth it!
  21.  
  22.     INCDIR    "GMSDev:Includes/"
  23.     INCLUDE    "dpkernel/dpkernel.i"
  24.     INCLUDE    "files/objects.i"
  25.     INCLUDE    "modules/objects.i"
  26.  
  27.     SECTION    "Objects",CODE
  28.  
  29. ;===========================================================================;
  30. ;                             INITIALISE DEMO
  31. ;===========================================================================;
  32.  
  33.     STARTDPK
  34.  
  35. Start:    MOVEM.L    A0-A6/D1-D7,-(SP)
  36.     move.l    DPKBase(pc),a6
  37.     lea    OBJFileName(pc),a0
  38.     moveq    #ID_OBJECTFILE,d0
  39.     CALL    Load
  40.     move.l    d0,ObjectBase
  41.     beq    .Exit
  42.  
  43.     ;Open the objects module.
  44.  
  45.     lea    ObjModTags(pc),a0    ;a0 = Module tags.
  46.     sub.l    a1,a1    ;a1 = No container.
  47.     CALL    Init    ;>> = Initialise Cards Interface.
  48.     tst.l    d0    ;d0 = Check for error.
  49.     beq    .Exit    ;>> = Error, exit.
  50.     move.l    d0,a0    ;a0 = Card module.
  51.     move.l    MOD_ModBase(a0),OBJBase    ;ma = Store jump table.
  52.  
  53.     ;Load the file, then start
  54.     ;getting our objects.
  55.  
  56.     move.l    OBJBase(pc),a6
  57.     move.l    ObjectBase(pc),a0    ;a0 = Object Base.
  58.     lea    TXT_ScreenName(pc),a1    ;a1 = The name of the object to get.
  59.     CALL    GetFileObject    ;>> = Get our GameScreen object.
  60.     move.l    d0,Screen    ;a0 = Screen tags of our object.
  61.     beq    .Exit    ;>> = Quit if error.
  62.  
  63.     move.l    OBJBase(pc),a6
  64.     move.l    ObjectBase(pc),a0    ;a0 = Object Base.
  65.     lea    TXT_PictureName(pc),a1    ;a1 = The name of the object to get.
  66.     CALL    GetFileObject    ;>> = Get our GameScreen object.
  67.     move.l    d0,Picture    ;>> = Picture tags of our object.
  68.     beq.s    .Exit    ;>> = Quit if error.
  69.  
  70.     ;Initialise the screen.
  71.  
  72.     move.l    DPKBase(pc),a6
  73.     move.l    Screen(pc),a0    ;a0 = Screen tags
  74.     sub.l    a1,a1
  75.     CALL    Init    ;>> = Initialise the screen.
  76.     tst.l    d0    ;ma = Save pointer to the GameScreen.
  77.     beq.s    .Exit    ;>> = Quit if error.
  78.  
  79.     ;Initialise the picture.
  80.  
  81.     move.l    Picture(pc),a0
  82.     move.l    Screen(pc),a1
  83.     move.l    PIC_Bitmap(a0),a2
  84.     move.l    GS_MemPtr1(a1),BMP_Data(a2)
  85.     sub.l    a1,a1
  86.     CALL    Init
  87.     tst.l    d0
  88.     beq.s    .Exit
  89.  
  90.     move.l    SCRBase(pc),a6
  91.     move.l    Screen(pc),a0
  92.     move.l    Picture(pc),a1
  93.     move.l    PIC_Palette(a1),GS_Palette(a0)
  94.     CALL    scrUpdatePalette
  95.  
  96.     move.l    DPKBase(pc),a6
  97.     moveq    #ID_JOYDATA,d0    ;Get joydata structure for reading
  98.     CALL    Get    ;port 0.
  99.     move.l    d0,JoyData
  100.     beq.s    .Exit
  101.     move.l    d0,a0    ;Initialise the joydata structure.
  102.     sub.l    a1,a1
  103.     CALL    Init
  104.     tst.l    d0
  105.     beq.s    .Exit
  106.  
  107.     move.l    Screen(pc),a0
  108.     CALL    Display
  109.  
  110.     bsr.s    Main
  111.  
  112. .Exit    move.l    DPKBase(pc),a6
  113.     move.l    JoyData(pc),a0
  114.     CALL    Free
  115.     move.l    Picture(pc),a0
  116.     CALL    Free
  117.     move.l    Screen(pc),a0
  118.     CALL    Free
  119.     move.l    ObjectBase(pc),a0
  120.     CALL    Free
  121.     move.l    ObjModule(pc),a0
  122.     CALL    Free
  123.     MOVEM.L    (SP)+,A0-A6/D1-D7
  124.     moveq    #ERR_OK,d0
  125.     rts
  126.  
  127. ;===========================================================================;
  128. ;                                MAIN LOOP
  129. ;===========================================================================;
  130.  
  131. Main:    move.l    SCRBase(pc),a6
  132.     CALL    scrWaitAVBL
  133.  
  134.     move.l    DPKBase(pc),a6
  135.     move.l    JoyData(pc),a0
  136.     CALL    Query
  137.     move.l    JoyData(pc),a0
  138.     move.l    JD_Buttons(a0),d0
  139.     btst    #JB_LMB,d0
  140.     beq.s    Main
  141.     rts
  142.  
  143. ;===========================================================================;
  144. ;                                  DATA
  145. ;===========================================================================;
  146.  
  147. Screen:        dc.l  0
  148. Picture:    dc.l  0
  149. JoyData:    dc.l  0
  150. ObjectBase:    dc.l  0
  151. OBJBase:    dc.l  0
  152. OBJFileName:    FILENAME "GMS:demos/data/OBJ.Screen"
  153.  
  154. TXT_ScreenName:    dc.b  "Screen",0
  155.         even
  156. TXT_PictureName    dc.b  "Picture",0
  157.         even
  158.  
  159. ObjModTags:    dc.l  TAGS_MODULE
  160. ObjModule:    dc.l  0
  161.         dc.l  MODA_Name,ObjName
  162.         dc.l  TAGEND
  163.  
  164. ObjName:    dc.b  "mod.objects",0
  165.         even
  166.  
  167. ;===========================================================================;
  168.  
  169. ProgName:    dc.b  "Screen Object",0
  170. ProgAuthor:    dc.b  "Paul Manias",0
  171. ProgDate:    dc.b  "9 December 1997",0
  172. ProgCopyright:    dc.b  "DreamWorld Productions (c) 1996-1997.  Freely distributable.",0
  173. ProgShort:    dc.b  "Screen Object demonstration.",0
  174.         even
  175.  
  176.